Eliminating Duplication in Source Code via Procedure Extraction
نویسندگان
چکیده
Duplication in source code is a widespread phenomenon that increases program size and complexity, and makes program maintenance more difficult. A solution to this problem is to detect clones (instances of copied code) and to eliminate them. Elimination works by extracting the cloned code into a separate new procedure, and replacing each clone by a call to this procedure. Several automatic approaches to detecting clones have been reported in the literature. In this paper we address the issue of automatically extracting a previously detected group of clones into a separate procedure. We present an algorithm that can extract “difficult” groups of clones, and a study that shows that difficult clone groups arise frequently in practice, and that our algorithm handles them well.
منابع مشابه
Tool Support for Refactoring Duplicated OO Code
Code duplication is an important problem in application maintenance. Tools exist that support code duplication detection. However, few of them propose a solution for the problem, i.e. refactorings. We propose an approach that uses the information given by code duplication detection to guide the refactorings of OO applications. 1 Code Duplication and Refactorings: Two Poles of a Magnet Code dupl...
متن کاملPinda: A Web service for detection and analysis of intraspecies gene duplication events
We present Pinda, a Web service for the detection and analysis of possible duplications of a given protein or DNA sequence within a source species. Pinda fully automates the whole gene duplication detection procedure, from performing the initial similarity searches, to generating the multiple sequence alignments and the corresponding phylogenetic trees, to bootstrapping the trees and producing ...
متن کاملREPRESENTATION, ANALYSIS, AND REFACTORING TECHNIQUES TO SUPPORT CODE CLONE MAINTENANCE by ROBERT AMBROSIUS TAIRAS BARRETT BRYANT, COMMITTEE CHAIR
The existence of code cloning, which represents identical or near identical sections of code, has been documented to occur frequently in software systems. The main purpose of cloning is the reuse of a code fragment that performs some functionality by copying and pasting it to a new location in the source code. Code clones embody a unique form of coupling, because their similarity inadvertently ...
متن کاملCompilation as Partial Evaluation of Functor Category Semantics
Our goal is to produce the same compiler as Reynolds 12] via partial evaluation. We develop a continuation semantics for a higher-order, imperative, call-by-name Algol-like language which is based on the functor category semantics of Reynolds and Oles 11], and compile programs via the rst Futumura projection. Our \compilation semantics" is non-standard in some ways (e.g., the meanings of expres...
متن کاملThe Effectiveness of Copy Cataloging at Eliminating Typographical Errors in Shared Bibliographic Records
database such as OCLC WorldCat, has increased librarians’ efficiency by eliminating duplication of effort. One library creates a bibliographic record for an item such as a book and many other libraries can copy or migrate the data into their local online catalogs, thus saving each individual library the work of cataloging the item and entering the data into the system. However, the ability to c...
متن کامل